home *** CD-ROM | disk | FTP | other *** search
Text File | 1999-02-10 | 2.8 KB | 106 lines | [TEXT/MPS ] |
- ;
- ; File: DRVRGlue.a
- ;
- ; Contains: DRVR interface
-
- ;
- ; Copyright: 1998 by Apple Computer, Inc., all rights reserved.
- ;
- ; Change History:
- ;
- ; 27 Jul 98 oja VMImmuneMask not set so that we HoldMemory on io buffers, param blocks
- ; 24 Apr 98 oja DrvrDone takes an error, passes on to JIODone
- ; 26 Mar 98 oja changed driver name to ".USB--Print___"
- ; 28 Feb 98 oja loosely based on Apple's StyleWriter DRVR
- ;
- ; To Do:
- ;
-
-
- BLANKS ON
- STRING ASIS
-
- INCLUDE 'LowMem.a'
- INCLUDE 'Devices.a'
- ;
- ; for an explanation of VMimmune and gestalt see AsyncDriverSample 1.0b4
- ;
- dVMImmuneMask EQU $0001
- dDriverGestaltEnableMask EQU $0004 ; See DriverGestalt.h
-
- drvrFlags EQU dReadEnableMask + dWritEnableMask + dCtlEnableMask + dStatEnableMask
- drvrSystemFlags EQU dNeedLockMask
-
- DRVREntry MAIN EXPORT
-
- IMPORT DRVROpen, DRVRPrime, DRVRControl, DRVRStatus, DRVRClose
-
- Header
- dc.w drvrFlags + drvrSystemFlags
- DC.W 0 ; no run time
- DC.W 0 ; no events
- DC.W 0 ; no menu
-
- ; Entry point offset table to the procs: Open, Prime, Control, Status, Close
- DC.W MyOpen - DRVREntry ; open routine
- DC.W MyPrime - DRVREntry ; prime
- DC.W MyControl - DRVREntry ; control
- DC.W MyStatus - DRVREntry ; status
- DC.W MyClose - DRVREntry ; close
-
- ; Title
- ; include three pad bytes so we can re-number the driver
- DC.B 14 ;Length byte
- DC.B '.USB--Print---' ;Pad to odd # of chars, so 1st routine
- ; will be word-aligned.
-
- ; Push the address of the routine we wish to call and jump to the glue
- ; which sets up the parameters and calls the actual driver implementation
- MyOpen PEA DRVROpen
- bra.s MyGlue
- MyPrime PEA DRVRPrime
- bra.s MyGlue
- MyControl PEA DRVRControl
- bra.s MyGlue
- MyStatus PEA DRVRStatus
- bra.s MyGlue
- MyClose PEA DRVRClose
-
- MyGlue
- MOVEM.L A0/A1,-(A7) ; save params to the routine
- CLR.W -(A7) ; make room for result
- MOVE.L A0,-(A7) ; pass the parameter block
- MOVE.L A1,-(A7) ; pass the device control entry
- MOVEA.L $0012(A7),A0 ; address of routine to jump to
- JSR (A0) ; do it
- MOVE.W (A7)+,D0 ; get result
- MOVEM.L (A7)+,A0/A1 ; restore device parameters
- ADDQ.W #4,A7 ; pop routine address to clean up
- ; tst.w IOParam.ioResult(a0)
- ; beq.s IOComplete
- BTST #10,IOParam.ioTrap(A0) ; test for an async call
- BNE.S Done ; if not async, we're done
- IOComplete
- SUBQ.W #4,A7 ; else get the JIODone vector
- _LMGetJIODone ; so we can jump to it.
- Done
- RTS
- ;
- ;
- ; Change History:
- ; 24 Ar 1998, oja: pass the error in D0
- ;
- DRVRDONE PROC EXPORT
-
- MOVE.L 4(sp),a0 ; pass the parameter block
- MOVE.L 8(sp),a1 ; pass the device control entry
- MOVE.W 12(sp),d0
- SUBQ.W #4,A7 ; get the JIODone vector
- _LMGetJIODone ; jump to it.
-
- RTS
-
- ENDPROC
- END
-
-